import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home',
    name: 'layout',
    component: () => import('../views/layout'),
    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('../views/home')
      },
      {
        path: 'quest',
        name: 'quest',
        component: () => import('../views/quest')
      },
      {
        path: 'video',
        name: 'video',
        component: () => import('../views/video')
      },
      {
        path: 'my',
        name: 'my',
        component: () => import('../views/my')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/login')
  },
  {
    path: '/userinfo',
    name: 'userinfo',
    component: () => import('../views/userinfo')
  },
  {
    path: '/article/:id',
    name: 'article',
    component: () => import('../views/article')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/search')
  },
  {
    path: '/history',
    name: 'history',
    component: () => import('../views/history')
  },
  {
    path: '/collect',
    name: 'collect',
    component: () => import('../views/collect')
  }
]

const router = new VueRouter({
  routes
})

export default router
